// HorizontalMirroringFilter.java
//
// Informatics 102 Spring 2012
// Assignment #2: Metadata and Reflection
//
// This is a built-in filter that mirrors an image horizontally.  Note that
// this filter is not built as a plug-in, so it doesn't conform to any of
// the requirements for plug-ins (e.g., no @FilterPlugIn annotations).  It's
// included so that the program will have one default filter installed, so
// you can experiment with the user interface before implementing the
// plug-in system.

package inf102.assignment2.filters;


public class HorizontalMirroringFilter implements Filter
{
	public String getName()
	{
		return "Mirror Horizontally";
	}
	
	
	public void execute(FilterableImage image)
	{
		int[][] pixels = image.getPixels();
		
		for (int x = 0; x < image.getWidth() / 2; x++)
		{
			for (int y = 0; y < image.getHeight(); y++)
			{
				int temp = pixels[x][y];
				pixels[x][y] = pixels[image.getWidth() - x - 1][y];
				pixels[image.getWidth() - x - 1][y] = temp;
			}
		}
	}
}
